package org.example.mall.Pojo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;

import java.time.LocalDateTime;

@Data//自动加载setter、getter和tostring方法
public class Users {
    private Integer Id;//系统id

    private String Username;//用户名

    @JsonIgnore//让springmvc将当前对象转换为JSON字符串时忽略password，增强安全性
    private String Password;//密码

    @JsonProperty(value = "Nickname", required = true)
    @NotEmpty
    @Pattern(regexp = "^\\S{1,10}$")
    private String Nickname;//用户昵称

    @JsonProperty(value = "Email", required = true)
    @NotEmpty
    @Email
    private String Email;//用户邮箱

    private String UserPic;//用户头像，存放于第三方服务器，这里放的是服务器url
    private LocalDateTime CreateTime;//账号创建时间
    private LocalDateTime UpdateTime;//账号更新时间
}
